/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package biojavagoalz.io;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * File reading class
 * @author Tadas
 */
public class PlainTextReader implements InputReader {

    private BufferedReader br;
    private FileReader fr;

    public PlainTextReader(File file) {
        try {
            fr = new FileReader(file);
            br = new BufferedReader(fr);
        } catch (FileNotFoundException e) {
            System.out.println("Reading File not found...");
        } catch (IOException e) {
            Logger.getLogger(PlainTextReader.class.getName()).log(Level.SEVERE, null, e);
        }
    }

    public String getInput() {
        try {
            return br.readLine();
        } catch (IOException ex) {
            Logger.getLogger(PlainTextReader.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }

    public void close() {
        try {
            fr.close();
        } catch (IOException ex) {
            Logger.getLogger(PlainTextReader.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
